package com.etone.smartAudit.controller;

import com.etone.smartAudit.service.ProductMapTypeService;
import com.etone.smartAudit.vo.PagerVO;
import com.etone.smartAudit.vo.productMapType.ProductMapCntVO;
import com.etone.smartAudit.vo.productMapType.ProductMapTypeVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: sovy
 * @date: 2020/12/23
 * @description:
 */
@RestController
@AllArgsConstructor
@Api(tags = "产品地图类型")
public class ProductMapTypeController {
    private ProductMapTypeService productMapTypeService;

    @ApiOperation(value = "能力类别列表")
    @GetMapping("/productMapTypes/abilityTypes")
    public PagerVO<ProductMapTypeVO> list(
            @ApiParam(value = "当前页") @RequestParam(required = false, defaultValue = "1") int page,
            @ApiParam(value = "每页显示数量") @RequestParam(required = false, defaultValue = "10") int pageSize
    ) {
        return productMapTypeService.list(0, page, pageSize);
    }

    @ApiOperation(value = "产品服务性质列表")
    @GetMapping("/productMapTypes/abilityTypes/{id}/serviceNature")
    public PagerVO<ProductMapTypeVO> list(
            @ApiParam(value = "产品地图id") @PathVariable Integer id,
            @ApiParam(value = "当前页") @RequestParam(required = false, defaultValue = "1") int page,
            @ApiParam(value = "每页显示数量") @RequestParam(required = false, defaultValue = "10") int pageSize
    ) {
        return productMapTypeService.list(id, page, pageSize);
    }

    @ApiOperation(value = "产品地图分类统计")
    @GetMapping("/productMapTypes/productMaps/cnt")
    public List<ProductMapCntVO> findProductMapCnt(){
        return productMapTypeService.findProductMapCnt();
    }
}
